package com.wntms.wgj.dao;

import com.wntms.wgj.pojo.*;
import org.apache.ibatis.annotations.*;

@Mapper
public interface CarriageContractsDao {
    /**
     * 根据运输合同表id查询运输合同表对象
     * @param id
     * @return
     */
    @Select("select * from carriage_contract where cid = #{id}")
    @Results({
            @Result(id = true,property = "cid",column = "cid"),
            @Result(property = "fid",column = "fid"),
            @Result(property = "senderid",column = "senderid"),
            @Result(property = "receiveAddress",column = "receive_address"),
            @Result(property = "shippingTime",column = "shipping_time"),
            @Result(property = "arrivalTime",column = "arrival_time"),
            @Result(property = "receiverid",column = "receiverid"),
            @Result(property = "insurance",column = "insurance"),
            @Result(property = "fare",column = "fare"),
            @Result(property = "status",column = "status"),
            @Result(property = "sence",column = "sence"),
            @Result(property = "sence",column = "sence"),
            @Result(property = "diid",column = "diid"),
            @Result(property = "customerInformations",column = "senderid",javaType = CustomerInformations.class,
                    one = @One(select = "com.wntms.wgj.dao.CustomerInformationDaos.findById")),
            @Result(property = "customerIns",column = "receiverid",javaType = CustomerIns.class,
                    one = @One(select = "com.wntms.wgj.dao.CustomerInDaos.findById")),
            @Result(property = "driverInformations",column = "diid",javaType = DriverInformations.class,
                    one = @One(select = "com.wntms.wgj.dao.DriverInformationsDao.findById")),
            @Result(property = "freightStatus",column = "status",javaType = FreightStatus.class,
                    one = @One(select = "com.wntms.wgj.dao.FreightStatusDao.findById"))
    })
    public CarriageContracts findById(String id);
}
